<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AppendTimeToOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('orders', function (Blueprint $table) {
            $table->integer('arrive_time')->nullable()->comment('到达时间');
            $table->integer('start_time')->nullable()->comment('到达时间');
            $table->integer('summary_time')->nullable()->comment('到达时间');
            $table->integer('comment_time')->nullable()->comment('到达时间');
            $table->decimal('cost_price', 10, 2)->nullable()->comment('实际行城资费');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if (Schema::hasColumns('orders', ['arrive_time', 'start_time', 'summary_time', 'comment_time', 'cost_price'])) {
            Schema::table('orders', function (Blueprint $table) {
                $table->dropColumn(['arrive_time', 'start_time', 'summary_time', 'comment_time', 'cost_price']);
            });
        }
    }
}
